"use strict";
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __param = (this && this.__param) || function (paramIndex, decorator) {
    return function (target, key) { decorator(target, key, paramIndex); }
};
Object.defineProperty(exports, "__esModule", { value: true });
const maishu_node_mvc_1 = require("maishu-node-mvc");
const attributes_1 = require("maishu-node-mvc/dist/attributes");
let PagesController = class PagesController {
    mobileIndex({ id }, request, response) {
        let m = (request.headers["user-agent"] || "").match(/MicroMessenger/i);
        let isWeiXin = m != null && m[0] == "MicroMessenger";
        if (isWeiXin) {
            let loginInfo = JSON.stringify({});
            response.setHeader("Set-Cookie", `app-login-info=${loginInfo}`);
        }
        // return this.content(mobileIndexHTML, "text/html; charset=utf-8");
        return new maishu_node_mvc_1.ContentResult(mobileIndexHTML, "text/html; charset=utf-8");
    }
};
__decorate([
    maishu_node_mvc_1.action("/mobile"),
    __param(0, maishu_node_mvc_1.routeData), __param(1, attributes_1.request), __param(2, attributes_1.response)
], PagesController.prototype, "mobileIndex", null);
PagesController = __decorate([
    maishu_node_mvc_1.controller()
], PagesController);
exports.PagesController = PagesController;
let mobileIndexHTML = `<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=10" />
    <meta name="viewport"
        content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no" />
    <title></title>

    <link rel="stylesheet" type="text/css" href="content/bootstrap.css" />
    <link rel="stylesheet" type="text/css" href="assert/lib/Font-Awesome-3.2.1/css/font-awesome.css" />

    <style>
        .mobile-page {
            width: 100%;
            height: 100%;
            position: absolute;
        }

        .mobile-page .loading {
            text-align: center;
            padding-top: 20px;
            padding-bottom: 20px;
        }

        @media screen and (min-width:480px) {
            .mobile-page {
                max-width: 480px;
                left: 50%;
                margin-left: -240px;
            }

            .page {
                max-width: 480px;
                left: 50%;
                margin-left: -240px;
                position: absolute;
            }
        }
    </style>
</head>

<body>
    <script data-main="mobile/index" src="/node_modules/requirejs/require.js"></script>
</body>

</html>`;
